/**
 * @name: user.js
 * @author: win10
 * @date: 2023/11/14 15:36
 * @description：user.js
 * @update: 2023/11/14 15:36
 */
import { defineStore } from 'pinia'

export const useUserStore = defineStore({
  id: `login`,
  state: () => {
    return {
      nickname: ``,
      avatar: ``,
      token: ``,
      routes: [],
    }
  },
  actions: {
    setNickname(nickname) {
      this.nickname = nickname
    },
    setAvatar(avatar) {
      this.avatar = avatar
    },
    setToken(token) {
      this.token = token
    },
    setRoutes(routes) {
      this.routes = routes
    },

    getNickname() {
      return this.nickname
    },
    getAvatar() {
      return this.avatar
    },
    getToken() {
      return this.token
    },
    getRoutes() {
      return this.routes
    },
  },
  persist: true,
})
